#include <stdio.h>
extern "C"{
#include <samalloc.h>
}
int main() {
	int * pointers = (int*)samalloc(sizeof(int *)*10); 
	int * pointers2 =(int*)samalloc(sizeof(int *)*10); 
	int * pointers3 =(int*)samalloc(sizeof(int *)*10); 
	int * pointers4 =(int*)samalloc(sizeof(int *)*10); 

    int size;
    for (int i = 0; i < 10; ++i) {
        pointers[i] = i;
    }
	print_heap_dump();
	printf("!!!!!!!!!!!!!!!!!!!!!!\n");
	void ** ptr = pointer_to_heap();
	printf("%p ", *ptr);
	fflush(stdout);
	void * nextptr = getnext_ptr_in_heap(ptr);
//	void** nnextptr=&nextptr;
	printf("result1\n");
	printf("%p\n ", nextptr);
	nextptr = getnext_ptr_in_heap(&nextptr);
	printf("result2\n");
	printf("%p ", nextptr);
	nextptr = getnext_ptr_in_heap(&nextptr);
	printf("result3\n");
	printf("%p ", nextptr);
    for (int i = 0; i < 10; i += 2) {
        safree(pointers);
    }
    
  //  struct myinfo info = myinfo();
    for (int i = 1; i < 10; i+= 2) {
//        printf("%d ", *(pointers[i]));
    }
    printf("\n");
    print_heap_dump();
   // info = myinfo();
    for (int i = 1; i < 10; i+= 2) {
//        printf("%d ", *(pointers[i]));
    }
    printf("\n");
}
